package musicstore.biz.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import musicstore.biz.AlbumBiz;
import musicstore.entity.Album;
import musicstore.mapper.AlbumMapper;

@Service
public class AlbumBizImpl implements AlbumBiz {
	@Autowired
	private AlbumMapper alubmMapper;

	@Override
	public void add(Album album) {
		alubmMapper.add(album);

	}

	@Override
	public void update(Album album) {
		alubmMapper.update(album);

	}

	@Override
	public void delete(int id) {
		alubmMapper.delete(id);
	}

	@Override
	public Album fetchById(int id) {
		return alubmMapper.fetchById(id);
	}

	@Override
	public List<Album> getAlbums(int genreId) {
		return alubmMapper.getAlbums(genreId);

	}


	@Override
	public List<Album> fetchAlbumspage(int genreId, String title, int pageNum, int pageSize) {
		return alubmMapper.fetchAlbumspage(genreId,title,(pageNum-1)*pageSize, pageSize);
	}

	@Override
	public int getRows(int genreId, String title) {
		return alubmMapper.getRows(genreId,title);
	}


}
